<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <load href="HOME_URL/js/qrcode.js" />
	<load href="HOME_URL/js/Base.js" />
	<load href="HOME_URL/js/prototype.js" />
	<load href="HOME_URL/js/mootools.js" />
	<load href="HOME_URL/js/Ajax/ThinkAjax.js" />
    <script src="HOME_URL/js/jquery.min.js"></script>
    <script type="text/javascript">
        function Check()
        {  var url = "{{:U('Wxpay/orderQuery')}}";
            var data = {out_trade_no:"{{$out_trade_no}}",id:"{{$id}}"};
            //var out_trade_no = "<?php echo $out_trade_no; ?>"; 
            $.post(url,data,function(res){
                var obj = eval("("+res+")");
                if(obj.code == 200 ){
                    $("#result").css('color','red').text(obj.msg);
                    window.clearInterval(int); //销毁定时器
                    setTimeout(function(){
                    //跳转到结果页面，并传递状态
                    window.location.href = "{{:U('Home/Personal/order_detail',array('ordtype'=>payed,'id'=>$id))}}";
                    },2000)
         
                }else if(obj.code ==201){
                    //alert("{{i}}");return;
                    //alert(obj.i);
                    $("#result").text(obj.msg);
                    if(obj.i == 0){
                        window.clearInterval(int); //销毁定时器
                        $("#result").css('color','red').text('支付超时,页面即将跳转....');
                        setTimeout(function(){
                        //跳转到结果页面，并传递状态
                        window.location.href = "{{:U('Home/Personal/order_detail',array('ordtype'=>unpay,'id'=>$id))}}";
                        },2000)
                    }
                    
                }
                //alert(res.code);
                //$("#result").text(res.msg);
            },'json')
            //ThinkAjax.send('__URL__/orderQuery','ajax=1&out_trade_no='+out_trade_no,'','result');
            //var result_msg=documnet.getElementById("result").innerHTML;
            //alert(result_msg);
        }
        var int = window.self.setInterval("Check()",3000); 
    </script>
	<?php $_SESSION['i'] = 300;?>
</head>
<body >
    <!-- <div style="width: 1200px"></div>
	<div style="width: 700px;height: 495px;background-color: #2280ae;border-radius: 15px"> </div> -->
    <div style="position: absolute;left: 29%;top: 9px;width: 600px;height: 490px;border-top:10px solid rgba(200,200,200,0.5);border-right:10px solid rgba(200,200,200,0.5);border-bottom:10px solid rgba(200,200,200,0.5);border-left:10px solid rgba(200,200,200,0.5);border-radius: 15px">
    <img src="HOME_URL/img/logo_wx.png"style="width: 30%;
    margin-left: 60px;
    position: absolute;">
    <div align="center" id="qrcode" style="margin-top: 150px">
    </div>
    <div align="center" >
        <div id="result" style="color: red"></div>
        <div style="clear: both;"></div>
        <div id="list"></div>
    </div>
    </div>
    </div>
</body>
    <script>
        if(<?php echo $unifiedOrderResult["code_url"] != NULL; ?>)
        {
            var url = "<?php echo $code_url;?>";
            //参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
            var qr = qrcode(10, 'H');
            qr.addData(url);
            qr.make();
            var wording=document.createElement('p');
            wording.innerHTML = "订单号：<?php echo $out_trade_no; ?>";
            var code=document.createElement('DIV');
            code.innerHTML = qr.createImgTag();
            var element=document.getElementById("qrcode");
            element.appendChild(wording);
            element.appendChild(code);
        }
    </script>
</html>